#ifndef __GSLAPP_H
#define __GSLAPP_H

#include <iostream>

#include <gsl/gsl_math.h>
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
#include <gsl/gsl_sf.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>

#include <gsl/gsl_rng.h>
//#include <gsl/gsl_cblas.h>
#include <gsl/gsl_linalg.h>
#include <gsl/gsl_eigen.h>

#include <gsl/gsl_combination.h>

#include <gsl/gsl_randist.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_odeiv.h>
#include <gsl/gsl_spline.h>
#include <gsl/gsl_integration.h>

const gsl_complex	COMPLEX_ONE_GSL  = gsl_complex_rect(1., 0.);
const gsl_complex	COMPLEX_ZERO_GSL = gsl_complex_rect(0., 0.);

ostream             &operator << (ostream &c, gsl_complex z);

gsl_complex         operator - (gsl_complex z);

gsl_complex         operator + (gsl_complex z1, gsl_complex z2);
gsl_complex         operator - (gsl_complex z1, gsl_complex z2);
gsl_complex         operator * (gsl_complex z1, gsl_complex z2);
gsl_complex         operator / (gsl_complex z1, gsl_complex z2);

gsl_complex         operator + (double d, gsl_complex z);
gsl_complex         operator + (gsl_complex z, double d);

gsl_complex         operator - (double d, gsl_complex z);
gsl_complex         operator - (gsl_complex z, double d);

gsl_complex         operator * (double d, gsl_complex z);
gsl_complex         operator * (gsl_complex z, double d);

gsl_complex         operator / (double d, gsl_complex z);
gsl_complex         operator / (gsl_complex z, double d);

gsl_complex         gsl_double_2_complex (double d);
int					gsl_vector_double_2_complex (gsl_vector * v_src, gsl_vector_complex  * v_dest);
int					gsl_matrix_double_2_complex (gsl_matrix * m_src, gsl_matrix_complex  * m_dest);

int					gsl_matrix_complex_conj_transpose(gsl_matrix_complex * m);

double				gsl_matrix_trace(gsl_matrix * m);
gsl_complex			gsl_matrix_complex_trace(gsl_matrix_complex * m);
gsl_complex			gsl_matrix_complex_trace1(gsl_matrix_complex * m, double * coeff);

int					gsl_vector_complex_scale(gsl_vector_complex v, gsl_complex z);

int					gsl_matrix_row_transform(size_t n_row, double * val, gsl_matrix * m);
int					gsl_matrix_complex_row_transform(size_t nrow, gsl_complex * val, gsl_matrix_complex * m);
#endif
